package com.example.animationdrawable_demo;

import android.R.anim;
import android.app.Activity;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;

public class MainActivity extends Activity implements OnClickListener{
	ImageView imgViewAnim;
	Button btnStart;
	AnimationDrawable anim;
	@Override
	protected void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		
		imgViewAnim= (ImageView) findViewById(R.id.imgView_anim);
		btnStart=(Button) findViewById(R.id.btn_start);
		btnStart.setOnClickListener(this);
		anim=(AnimationDrawable) imgViewAnim.getBackground();

	}
	@Override
	public void onClick(View v)
	{
		switch (v.getId()) {
		case R.id.btn_start:
			anim.start();
			break;

		default:
			break;
		}
		
	}
	

}
